package integer;

public class MathTest {
    public static void main(String[] args) {
        // 1 取绝对值  Math.abs(int i)
        System.out.println(Math.abs(12));
        System.out.println(Math.abs(-15));
        System.out.println(Math.abs(-3.14));

        // 2 向上取整  Math.ceil(double a)
        System.out.println(Math.ceil(4.00001));// 5

        // 3 向下取整  Math.floor(double a)
        System.out.println(Math.floor(4.999999));// 4

        // 4 四舍五入  Math.round(double a)
        System.out.println(Math.round(4.52));// 5
        System.out.println(Math.round(4.46));// 4

        // 5 取极值   Math.max/min(int a, int b)
        System.out.println(Math.max(13, 17));// 17
        System.out.println(Math.min(13, 17));// 13

        // System.exit(0);   人为终止Java虚拟机运行

        long time = System.currentTimeMillis();
        System.out.println(time);
        for (int i = 0; i < 100000; i++) {
            System.out.println("输出了；" + i);
        }
        long time2 = System.currentTimeMillis();
        System.out.println((time2 - time)/1000.0 + "s");
    }
}